package siddur.traktask.web.model;

import java.util.ArrayList;
import java.util.List;

import siddur.traktask.entity.Memo;
import siddur.traktask.entity.ScreenShot;
import siddur.traktask.entity.TrakPeriod;

/*
 * for calendar web page
 */
public class DailyData {

	private List<HourVO> times;
	
	private List<MemoVO> memos;
	
	private List<ScreenShotVO> screenshots;
	
	private int seconds;
	
	/*
	 * timestamp is second based instead of millisecond
	 */
	public DailyData(List<TrakPeriod> _periods, List<Memo> _memos, List<ScreenShot> _screenshots) {
		times = new ArrayList<>(_periods.size());
		memos = new ArrayList<>(_memos.size());
		screenshots = new ArrayList<>(_screenshots.size());
		
		for (TrakPeriod p : _periods) {
			HourVO vo = new HourVO();
			vo.setId(p.getId());
			vo.setStart(p.getStartAt().getTime() / 1000);
			vo.setEnd(p.getEndAt().getTime() / 1000);
			times.add(vo);
			seconds += p.getSeconds();
		}
		
		for (Memo m : _memos) {
			MemoVO vo = new MemoVO();
			vo.setId(m.getId());
			vo.setStart(m.getCreatedAt().getTime() / 1000);
			vo.setMemo(m.getComment());
			memos.add(vo);
		}
		
		for (ScreenShot s : _screenshots) {
			ScreenShotVO vo = new ScreenShotVO();
			vo.setId(s.getId());
			vo.setStart(s.getCreatedAt().getTime() / 1000);
			screenshots.add(vo);
		}
	}

	public List<HourVO> getTimes() {
		return times;
	}

	public void setTimes(List<HourVO> times) {
		this.times = times;
	}

	public List<MemoVO> getMemos() {
		return memos;
	}

	public void setMemos(List<MemoVO> memos) {
		this.memos = memos;
	}

	public List<ScreenShotVO> getScreenshots() {
		return screenshots;
	}

	public void setScreenshots(List<ScreenShotVO> screenshots) {
		this.screenshots = screenshots;
	}

	public int getSeconds() {
		return seconds;
	}

	public void setSeconds(int seconds) {
		this.seconds = seconds;
	}
	
}
